﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NumbersNotDevisibleBy7And3
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            for (int index = 1; index <= N; index++)
            {
                if (index % 3 != 0 && index % 7 != 0 )
	            {
                    Console.WriteLine(index);
	            }
            }
        }
    }
}
